package
{
	import com.demonsters.debugger.MonsterDebugger;
	
	import flash.utils.ByteArray;
	
	import org.SFramework.Core.SFramework;
	import org.SFramework.Core.SViewCabinet;
	
	[SWF( width="600", height="400", frameRate="60" )]
	public class RatHammer extends SFramework
	{
		public function RatHammer()
		{
			super();
		}
		
		override protected function onAddToStage():void
		{			
			super.onAddToStage();
			
			MonsterDebugger.initialize( this );
			MonsterDebugger.inspect(this);
			
			try{ startInlineConfig( onFrameworkInitResult ) }catch(ex:*){}
		}
		
		private function onFrameworkInitResult( errCode : int, errMsg : String, ...params ) : void
		{
			// Handle Success code
			if( errCode >= 0 )
			{
				switch( errCode )
				{					
					case SFramework.SUCCESS:
						Global.viewsCabinet	=	SFramework.singleton.viewsCabinet as ViewsCabinet;
						Application.goMainMenu();
						break;
					
					case SFramework.RESOURCE_LOAD_COMPLETE:
						SFramework.singleton.resourceManager.loadStreamSwf( Assets.assetsSwfName, new Assets.assetsSwf() as ByteArray );
						SFramework.singleton.resourceManager.loadStreamFont( new Assets.fontSwf() as ByteArray );
						break;
				}				
			}
		}
		
		override protected function createViewCabinet():SViewCabinet
		{
			return new ViewsCabinet( this, resourceManager ) as SViewCabinet;
		}
	}
}